﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;

namespace DeSleeper.Client.Framework
{
    public class PageViewBase<TViewModel> : Page
        where TViewModel : ViewModelBase, new()
    {
        public TViewModel ViewModel
        {
            get { return (TViewModel)GetValue(ViewModelProperty); }
            set { SetValue(ViewModelProperty, value); }
        }

        /// <summary>
        /// Dependency Property definition for <see cref="ViewModel"/>
        /// </summary>
        public static readonly DependencyProperty ViewModelProperty =
            DependencyProperty.Register("ViewModel", typeof(TViewModel), typeof(PageViewBase<TViewModel>), new UIPropertyMetadata(new TViewModel()));

        public PageViewBase()
        {
            DataContext = ViewModel;
        }
    }
}
